#include "GameOver.h"
#include "RSManager.h"
#include "ShareComponents.h"

GameOver::GameOver(FWGame* scene):FWGame(scene)
{
	id_scene = GAME_OVER;
}


GameOver::~GameOver(void)
{
}
void GameOver::load()
{
	_option_icon = RSManager::getInstance()->getSprite(OPTION_ICON);
	_icon_pos =D3DXVECTOR2(190,140);
	delay=0;
	_isrender =true;
	continues= true;
	end =false;
}
void GameOver::update(float time)
{
	_isrender = true;
	if (delay > 100 )
	{
		delay = 0;
		_isrender = false;
	}
	if(gl_keyboard->isKeyPressed(DIK_SPACE))
	{
		if(_icon_pos.y==140)
		{
			_icon_pos.y = 110;
			continues= false;
			end =true;
		}
		else
		{
			_icon_pos.y =140;
			continues= true;
			end =false;
		}
	}
	if(gl_keyboard->isKeyPressed(DIK_RETURN))
	{
		if(continues) id_next_scene =MAINGAME;
		if(end) id_next_scene =MENU;
		return;
	}
}

void GameOver::render()
{
	_option_icon->Render( _icon_pos);
	gl_graphic->sDraw("1P\n\n      HI\n\n\n      GAME OVER",D3DXVECTOR2(43,62), D3DCOLOR_XRGB(188,188,188));
	if(_isrender)
	{
		gl_graphic->sDraw("0",D3DXVECTOR2(220,65),D3DCOLOR_XRGB(188,188,188));
		gl_graphic->sDraw("2000",D3DXVECTOR2(300,145),D3DCOLOR_XRGB(188,188,188));
	}
	gl_graphic->sDraw("CONTINUE",D3DXVECTOR2(240,320),D3DCOLOR_XRGB(188,188,188));
	gl_graphic->sDraw("END",D3DXVECTOR2(240,350),D3DCOLOR_XRGB(188,188,188));
}

void GameOver::shutdown()
{
}